package cn.smileyan.demo;

import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 *
 * @author Smileyan
 */
public class WordCountDemo {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStream<Tuple2<String, Integer>> data = env.fromElements(
                Tuple2.of("hello", 1),
                Tuple2.of("world", 2));

        data.flatMap(new WordCountRichFlatMapFunction()).print();

        env.execute("FlatMapFunction Example");
    }
}
